#include<bits/stdc++.h>
using namespace std;

map<int, map<int, int>> box;
 
int main()
{
	int n, p;
	cin>>n>>p;
	int flag;
	int i, j, data;
	while(p--)
	{
		cin>>flag;
		if(flag == 1)
		{
			cin>>i>>j>>data;
			box[i][j] = data;
		}
		else
		{
			cin>>i>>j;
			cout<<box[i][j]<<endl;
		}
	}
    return 0;
}

